package com.example.demo.utils;

import java.util.ArrayList;
import java.util.List;

import com.example.demo.utils.QRCodeUtil;
import lombok.extern.slf4j.Slf4j;


/**
 * @author 煜赜
 * @date 2020/4/8 15:36
 */
@Slf4j
public class QRCodeUtilTest {
    public static void  main(String [] args) throws Exception {
        List<String> urlList = new ArrayList<>();
        String id = "doctor-1";
        String text = "https://xmu.xxx.cn/api/bind" + id;

        String imgpath = "D:\\团队项目\\xmu_hospital\\src\\main\\resources\\static\\images\\2.jpg";
//        String imgpath = null;
        String destPath = "D:\\团队项目\\xmu_hospital\\src\\main\\resources\\static\\qrcode\\qrcode_test.jpg";
        try {
            QRCodeUtil.encode(text, imgpath, destPath, true);
        } catch (Exception e) {
            log.error("生成二维码错误：" + e.getMessage());
        }

        String str = null;
        try {
            str = QRCodeUtil.decode(destPath);
        } catch (Exception e) {
            log.error("解析二维码错误：" + e.getMessage());
        }
        System.out.println("二维码解析内容：" + str);
    }

}
